$(function () {

    var itemIndex = 0;
    var id = $('#topid').val();
    var type = $('#addload').data('type');
    var tabLoadEndArray = [false];
    var tabScroolTopArray = [0];
    var pagenum = 1;
    // dropload
    var dropload = $('.khfxWarp').dropload({
        scrollArea: window,
        domDown: {
            domClass: 'dropload-down',
            domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
            domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
            domNoData: '<div class="dropload-noData">没有更多数据了</div>'
        },
        loadDownFn: function (me) {
            setTimeout(function () {
                if (tabLoadEndArray[itemIndex]) {
                    me.resetload();
                    me.lock();
                    me.noData();
                    me.resetload();
                    return;
                }
                if(true){
                	$.ajax({
                        url: '/load/comment',
                        type: "GET",
                        data: {page: pagenum,id: id},
                        dataType: "json",//请求数据类型
                        success: function (data) {
                        	if(data.code == 0){
    	   						 var result = data.data;
    	   						 $("#ppp").append(result);
    	   						 if(data.hasnext){
    	   							 pagenum++;
    	   						 }else{
    	   							tabLoadEndArray[itemIndex] = true;
    	   						 }
    	   					 }
                        },
                        error: function () {
                        	sstb.dialog('加载失败');
                        }
                    })
                    me.resetload();
                }
            }, 500);
        }
    });

});